package com.xnfh.home.viewmodel

import com.xnfh.framework.base.BaseRepository
import com.xnfh.framework.bean.HomeAppVersion
import com.xnfh.framework.bean.HomeBannerBean
import com.xnfh.framework.bean.HomeTongjiBean
import com.xnfh.framework.bean.RespStateData
import com.xnfh.framework.bean.WeatherDetailBean
import com.xnfh.network.manager.ApiManager

/**
 * @Description:
 * @Author: ziheng
 * @CreateDate: 2024/1/2 14:02
 * @UpdateUser: ziheng
 * @UpdateDate: 2024/1/2 14:02
 * @UpdateRemark: 更新说明
 */
class HomeViewModelRes : BaseRepository() {

    suspend fun requestAppVersion(data: RespStateData<HomeAppVersion>) = dealResp(
        { ApiManager.api.requestAppVersion() }, data
    )

    suspend fun requestHomeBanner(data: RespStateData<List<HomeBannerBean>>) = dealResp(
        { ApiManager.api.requestTodayMessage() }, data
    )

    suspend fun requestTj(data: RespStateData<HomeTongjiBean>) = dealResp(
        { ApiManager.api.requestTj() }, data
    )

    suspend fun requestWeather(lonlats: String, data: RespStateData<WeatherDetailBean>) = dealResp(
        { ApiManager.api.requestWeather(lonlats) }, data
    )

    suspend fun requestNoReadNum(data: RespStateData<Int>) = dealResp(
        { ApiManager.api.requestNoRead() }, data
    )
}